using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Media;

namespace Tvnc.Controls;

public partial class ImageButton : UserControl
{
    public event EventHandler<RoutedEventArgs>? Click
    {
        add => this.AddHandler<RoutedEventArgs>(Button.ClickEvent, value);
        remove => this.RemoveHandler<RoutedEventArgs>(Button.ClickEvent, value);
    }
    
    public IImage? Source
    {
        get => this.GetValue<IImage>(Image.SourceProperty);
        set => this.SetValue<IImage>(Image.SourceProperty, value);
    }
    
    public string? Text
    {
        get => this.GetValue<string>(TextBlock.TextProperty);
        set => this.SetValue<string>(TextBlock.TextProperty, value);
    }
    public ImageButton()
    {
        InitializeComponent();
    }
}